home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / blkspell / mfc_exdl.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1998-09-22  |  2.8 KB  |  110 lines

  1. // mfc_exDlg.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "mfc_ex.h"
  6. #include "mfc_exDlg.h"
  7. #include "btdict.h"
  8.  
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14.  
  15. /////////////////////////////////////////////////////////////////////////////
  16. // CMfc_exDlg dialog
  17.  
  18. CMfc_exDlg::CMfc_exDlg(CWnd* pParent /*=NULL*/)
  19.     : CDialog(CMfc_exDlg::IDD, pParent)
  20. {
  21.     //{{AFX_DATA_INIT(CMfc_exDlg)
  22.         // NOTE: the ClassWizard will add member initialization here
  23.     //}}AFX_DATA_INIT
  24.     // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
  25.     m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
  26. }
  27.  
  28. void CMfc_exDlg::DoDataExchange(CDataExchange* pDX)
  29. {
  30.     CDialog::DoDataExchange(pDX);
  31.     //{{AFX_DATA_MAP(CMfc_exDlg)
  32.     DDX_Control(pDX, IDC_EDIT1, m_Edit);
  33.     //}}AFX_DATA_MAP
  34. }
  35.  
  36. BEGIN_MESSAGE_MAP(CMfc_exDlg, CDialog)
  37.     //{{AFX_MSG_MAP(CMfc_exDlg)
  38.     ON_WM_PAINT()
  39.     ON_WM_QUERYDRAGICON()
  40.     ON_BN_CLICKED(IDOK, OnSpellCheck)
  41.     ON_BN_CLICKED(IDC_BUTTON1, OnShowLicense)
  42.     //}}AFX_MSG_MAP
  43. END_MESSAGE_MAP()
  44.  
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CMfc_exDlg message handlers
  47.  
  48. BOOL CMfc_exDlg::OnInitDialog()
  49. {
  50.     CDialog::OnInitDialog();
  51.  
  52.     // Set the icon for this dialog.  The framework does this automatically
  53.     //  when the application's main window is not a dialog
  54.     SetIcon(m_hIcon, TRUE);            // Set big icon
  55.     SetIcon(m_hIcon, FALSE);        // Set small icon
  56.     
  57.     // TODO: Add extra initialization here
  58.     char *spchktst = "Ths wuold be a reely gud plice fer chckng yer spelng.";
  59.     m_Edit.SetWindowText( LPCTSTR(spchktst));
  60.     return TRUE;  // return TRUE  unless you set the focus to a control
  61. }
  62.  
  63. // If you add a minimize button to your dialog, you will need the code below
  64. //  to draw the icon.  For MFC applications using the document/view model,
  65. //  this is automatically done for you by the framework.
  66.  
  67. void CMfc_exDlg::OnPaint() 
  68. {
  69.     if (IsIconic())
  70.     {
  71.         CPaintDC dc(this); // device context for painting
  72.  
  73.         SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);
  74.  
  75.         // Center icon in client rectangle
  76.         int cxIcon = GetSystemMetrics(SM_CXICON);
  77.         int cyIcon = GetSystemMetrics(SM_CYICON);
  78.         CRect rect;
  79.         GetClientRect(&rect);
  80.         int x = (rect.Width() - cxIcon + 1) / 2;
  81.         int y = (rect.Height() - cyIcon + 1) / 2;
  82.  
  83.         // Draw the icon
  84.         dc.DrawIcon(x, y, m_hIcon);
  85.     }
  86.     else
  87.     {
  88.         CDialog::OnPaint();
  89.     }
  90. }
  91.  
  92. // The system calls this to obtain the cursor to display while the user drags
  93. //  the minimized window.
  94. HCURSOR CMfc_exDlg::OnQueryDragIcon()
  95. {
  96.     return (HCURSOR) m_hIcon;
  97. }
  98.  
  99. void CMfc_exDlg::OnSpellCheck() 
  100. {
  101.     // TODO: Add your control notification handler code here
  102.     SpellCheck(m_Edit.m_hWnd);    
  103. }
  104.  
  105. void CMfc_exDlg::OnShowLicense() 
  106. {
  107.     // TODO: Add your control notification handler code here
  108.     ShowLicense();    
  109. }
  110.